<?
//<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
session_start();
require ("inc.php");
$db_admin    = &new db($scfg['db']['admin']);
$rows  = 10;
$page  = (int)($_REQUEST['page']?$_REQUEST['page']:1);
admin_core::check();
/* 以下是程序部份 */
$table = $admin['table']['name'];
if($_POST['Pact'] == "modify_pass" && $_POST["password"])
{
	$master = admin_core::getMaster();
	if($master && admin_core::login($master, $_POST['oldpassword']))
	{
		$bind = array("password"=>admin_core::mixPass($_POST["password"]));
		$rs = $db_admin->update($table,$bind," `master` = ? ",$master);
		if($rs)
		{
			echo g::msg("成功：密码更新成功!");
		}else
		{
			echo g::msg("提示：系统忙，请重试!");
		}
		g::gowin("?");	
	}else
	{
		echo g::msg("提示：帐号或密码有误!");
		g::gowin("?");	
	}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link  href="static/admincp.css" rel="stylesheet" type="text/css" id="css">
<script src="Script/lib.js" 	type="text/javascript"></script>
<script src="Script/lib.ext.js" type="text/javascript"></script>
<script src="Script/lib.ext.oAdmin.js" type="text/javascript"></script>
<script type="text/javascript">
if(typeof XypForm == "undefined")
{
	_.r('<script src="static/xypform/xypfrom.js" type="text/javascript"></sc'+'ript>');
	_.r('<link  href="static/xypform/xypform.css" rel="stylesheet" type="text/css">');
}
var collapsed = $.cookie('DTh_collapse');
function collapse_change(menucount)
{
	if(_.e('menu_' + menucount).style.display == 'none') 
	{
		_.e('menu_' + menucount).style.display = '';collapsed = collapsed.replace('[' + menucount + ']' , '');
		_.e('menuimg_' + menucount).src = 'static/img/menu_reduce.gif';
	} else 
	{
		_.e('menu_' + menucount).style.display = 'none';collapsed += '[' + menucount + ']';
		_.e('menuimg_' + menucount).src = 'static/img/menu_add.gif';
	}
	$.cookie('DTh_collapse', collapsed, 2592000);
}
</script>
</head>
<body leftmargin="10" topmargin="10">
<table width="100%" border="0" cellpadding="2" cellspacing="6">
  <tr>
    <td>
      <form method="post" name="settings" id="settings" onsubmit="return XypForm(this)">
        <table width="100%" border="0" cellpadding="0" cellspacing="0" class="tableborder">
          <tr class="header">
            <td colspan="2">修改资料 - 密码更新</td>
          </tr>
          <tbody>
            <tr>
              <td width="40%" class="altbg1" ><b>现在的密码:</b><br />
                <span class="smalltxt">旧的密码，你之前使用的密码</span></td>
              <td class="altbg2"><input name="oldpassword"  require="1"  minlen="6"  maxlen="16"  type="password" id="oldpassword" size="50" ></td>
            </tr>
            <tr>
              <td width="40%" class="altbg1" ><b>设定新密码:</b><br />
                <span class="smalltxt">设定你想要的密码，6-16位。请注意密码的安全<br />
                </span></td>
              <td class="altbg2"><input type="password"  require="1"  minlen="6"  maxlen="16"  size="50" name="password"  id="password"></td>
            </tr>
            <tr>
              <td width="40%" class="altbg1" ><b>确认密码:</b><br />
                <span class="smalltxt">确认密码，确认一次</span></td>
              <td class="altbg2"><input type="password" require="1" again="password" size="50" name="password2" id="password2"></td>
            </tr>
            
          </tbody>
        </table>
        <br />
        <center>
          <input type="hidden"  name="Pact"   value="modify_pass">
          <input class="button" type="submit" value="提 交">
        </center>
      </form></td>
  </tr>
</table>
<br />
<br />
<? include("s_tpl.copyright.php"); ?>
</body>
</html>